/*
 * src/lexical/get_source_file.c
 * 
 * Harry Wei <harryxiyou@gmail.com> (C) 2012
 *
 * Get source file to RAM, these codes are under GPL.
 */
#include <stdio.h>
#include <glib.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include "common.h"
#include "cp_ctrl.h"

int get_source_file(struct la *ctrl, char *filename) {
	g_message("enter func %s", __func__);
	if (NULL == ctrl || NULL == filename) {
		g_message("%s -- Parameter error!", __func__);
		return -1;
	}
#if 1
	if (TRUE != g_str_has_suffix(filename, "c")) {
		g_message("%s -- This is not a c file!", __func__);
		return -1;
	}
#endif
	int ret = 0;
	ret = read_contents(ctrl, filename);
	g_assert(ret == 0);
	g_message("leave func %s", __func__);
	return 0;
}
